<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title></title>
    <!-- Bootstrap -->
    <link href="__CSS__/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="__CSS__/my.css">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="__JS__/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="__JS__/bootstrap.min.js"></script>
</head>
<body>




<div class="container">
    <div class="row ">
        <div class="col-md-12 column">
            <table class="table table-hover table-bordered ">
                <caption><h2>公告管理</h2></caption>
                <tr class=".active ">
                    <th>ID</th>
                    <th>公告内容</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>

                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.desc}</td>
                    <td>
                        {if $vo.status==1}
                            <button id="{$vo.id}" class="btn btn-danger status" data_id="{$vo.id}" >显示</button>
                        {else}
                            <button id="{$vo.id}" class="btn btn-info status" data_id="{$vo.id}" >隐藏</button>
                        {/if}
                    </td>

                    <td>
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                                <a href="{:url('admin/notice/edit',array('id'=>$vo['id']))}" class="btn btn-success" >编辑</a>
                                <a href="{:url('admin/notice/del',array('id'=>$vo['id']))}" class="btn btn-danger" >删除</a>
                            </div>
                        </div>

                    </td>
                </tr>
                {/volist}




            </table>




        </div>
    </div>



</div>

<script>
    $(function(){
        $('.status').click(function(){
           var id = $(this).attr('data_id');
//           console.log(id);
            $.ajax({
                type:'post',
                url: '/admin/Notice/status',
                data:{ 'id':id },
                dataType:'json',
                success:function(data){
                   if(data==1){
                       alert('显示');
                       $('#'+id).css('background-color','green').html('显示');

                   }else{
                       alert('隐藏');
                       $('#'+id).css('background-color','#ccc').html('隐藏');

                   }

                }

            })
        })
    })
</script>
</body>
</html>